import { SUCCESS_STATUS_ARR } from '@/config/status'
import { indexOf } from 'lodash'
import es6Promise from 'es6-promise'
!window.Promise || (window.Promise = es6Promise.Promise)

const promise = function (res) {
  return new Promise(function (resolve, reject) {
    indexOf(SUCCESS_STATUS_ARR, res.status) > -1 ? resolve(res) : reject(res)
  })
}

export default promise
